﻿using System.Runtime.InteropServices;

namespace System.Windows.Forms
{
    class TreeViewAero : System.Windows.Forms.TreeView
    {
        public const int WM_CREATE = 0x1;

        [DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]
        public extern static int SetWindowTheme(
            IntPtr hWnd, string pszSubAppName, string pszSubIdList);


        protected override void WndProc(ref Message m)
        {
            if (Environment.OSVersion.Version.Major >= 6)
                if (m.Msg == WM_CREATE)
                {
                    SetWindowTheme(this.Handle, "Explorer", null);
                }
            base.WndProc(ref m);
        }
    }
}
